package com.techprimers.mongodb.springbootmongodbexample.document;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@Document(collection = "device_status_history")
public class DeviceStatusHistory implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    @Indexed(background = true, name = "idx_device_id")
    @Field("device_id")
    private String deviceId;

    @Field("start_timestamp")
    private Long startTimestamp;

    @Field("pack_timestamp")
    private Long packTimestamp;

    @Field("status_history")
    private List<Object> statusHistory;

    @Field("create_time")
    private Date createTime;

    @Field("update_time")
    private Date updateTime;
}
